/**
 * Copyright (c) 2013-Now http://jeesite.com All rights reserved.
 */
package com.jeesite.modules.ajz.entity;

import com.jeesite.common.entity.DataEntity;
import com.jeesite.common.mybatis.annotation.Column;
import com.jeesite.common.mybatis.annotation.JoinTable;
import com.jeesite.common.mybatis.annotation.Table;
import com.jeesite.common.mybatis.mapper.query.QueryType;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotBlank;

/**
 * 模板内容Entity
 * @author cww
 * @version 2019-03-28
 */
@Table(name="ajz_model_content", alias="a", columns={
		@Column(name="id", attrName="id", label="id", isPK=true),
		@Column(name="model_id", attrName="modelId", label="模板id"),
		@Column(name="content", attrName="content", label="内容", queryType=QueryType.LIKE),
		@Column(includeEntity=DataEntity.class),
	},  joinTable={
		@JoinTable(type= JoinTable.Type.JOIN, entity=AjzModel.class,  alias="cmp",attrName="ajzModel",
				on="a.model_id = cmp.id", columns={
				@Column(name="danger_type", label="隐患类型"),
				@Column(name="base_type", label="主体类型"),
		}),
}, orderBy="a.update_date DESC"
)
public class AjzModelContent extends DataEntity<AjzModelContent> {
	
	private static final long serialVersionUID = 1L;
	private AjzModel ajzModel;		// 模板id
	private String content;		// 内容
	private String modelId;    //模板id
	
	public AjzModelContent() {
		this(null);
	}

	public AjzModelContent(String id){
		super(id);
	}

	public AjzModel getAjzModel() {
		return ajzModel;
	}

	public void setAjzModel(AjzModel ajzModel) {
		this.ajzModel = ajzModel;
	}

	@NotBlank(message="内容不能为空")
	@Length(min=0, max=255, message="内容长度不能超过 255 个字符")
	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	public String getModelId() {
		return modelId;
	}

	public void setModelId(String modelId) {
		this.modelId = modelId;
	}
}